/*
2021-7-20
https://www.acwing.com/problem/content/3777/
*/
#include<iostream>

using namespace std;
const int N=1e5+5;
int a[N],s1[N],s2[N];
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int n,m;
        cin>>n>>m;
        for(int i=1;i<=n;i++) cin>>a[i];
        a[++n]=m;

        for(int i=1;i<=n;i++)
        {
            s1[i]=s1[i-1],s2[i]=s2[i-1];
            if(i&1) s1[i]+=a[i]-a[i-1];
            else s2[i]+=a[i]-a[i-1];
        }
        int res=s1[n];

        for(int i=0;i<n;i++)
        {
            int t=a[i+1]-a[i];
            if(t==1) continue;
            res=max(res,s1[i]+s2[n]-s2[i+1]+t-1);
        }
        cout<<res<<endl;
    }
    return 0;
}
